package de.openkanban.client.ui.presenter;

import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.Response;
import com.smartgwt.client.util.SC;

import de.openkanban.client.util.RootPanel;
import de.openkanban.shared.dto.KanbanDto;

/**
 * Callback that handles move kanban to activity request
 */
public class MoveKanbanToActivityRequestCallback implements RequestCallback {

	@Override
	public void onResponseReceived(Request request, Response response) {
		KanbanDto kanbanDto = new KanbanDto(response.getText());
		if (kanbanDto.getFehlerKz() > 0) {
			SC.say(kanbanDto.getFehlerText());
		} else {
			RootPanel.main.getFooter().updateBoardHistoryData();
		}
	}

	@Override
	public void onError(Request request, Throwable exception) {
	}

}
